package gui;

import java.awt.Frame;

public class DialogFactory {
	private static DialogFactory instance = null;

	private DialogFactory() {

	}

	public void createDialog(DialogType dtype, Frame parent, boolean modal,
			String ccc) {

		switch (dtype) {
		case ADD_EMPLOYEE_DIALOG: {
			AUemployeeDialog d = new AUemployeeDialog(parent, modal);
			d.setDialogType(DialogType.ADD_EMPLOYEE_DIALOG);
			d.setCurrentComboBoxItem(ccc);
			d.setVisible(modal);
			break;
		}

		case UPDATE_EMPLOYEE_DIALOG: {
			AUemployeeDialog d = new AUemployeeDialog(parent, modal);
			d.setDialogType(DialogType.UPDATE_EMPLOYEE_DIALOG);
			d.setCurrentComboBoxItem(ccc);
			d.setVisible(modal);
			break;
		}

		case SEARCH_EMPLOYEE_DIALOG: {
			DSemployeeDialog d = new DSemployeeDialog(parent, modal);
			d.setDialogType(DialogType.SEARCH_EMPLOYEE_DIALOG);
			d.setCurrentComboBoxItem(ccc);
			d.setVisible(modal);
			break;
		}

		case DELETE_EMPLOYEE_DIALOG: {
			DSemployeeDialog d = new DSemployeeDialog(parent, modal);
			d.setDialogType(DialogType.DELETE_EMPLOYEE_DIALOG);
			d.setCurrentComboBoxItem(ccc);
			d.setVisible(modal);
			break;
		}

		case SERVER_PROPERTIES_DIALOG: {
			ServerPropertiesDialog d = new ServerPropertiesDialog(parent, modal);
			d.setDialogType(DialogType.DELETE_EMPLOYEE_DIALOG);
			d.setVisible(modal);
			break;
		}

		}

	}

	public static DialogFactory getInstance() {
		if (instance == null) {
			instance = new DialogFactory();
		}
		return instance;
	}

}
